package com.py.androidUtils.UI.view;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;

import com.py.androidUtils.utils.ToastUtil;
import com.readyidu.app.R;

public class ShowShareView {
	private Context mContext;

	public ShowShareView(Context context) {
		this.mContext = context;
	}

	public void showView(View view) {
		View photosiew = LayoutInflater.from(mContext).inflate(R.layout.common_share_view, null);
		final PopupWindow popupWindow = new PopupWindow(photosiew, android.view.ViewGroup.LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT);
		popupWindow.showAtLocation(view, Gravity.BOTTOM, 0, 0);
		((LinearLayout) photosiew.findViewById(R.id.line_bg)).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				popupWindow.dismiss();
			}
		});
		((ImageView) photosiew.findViewById(R.id.close)).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				popupWindow.dismiss();
			}
		});
		((ImageView) photosiew.findViewById(R.id.qq)).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				ToastUtil.showToast(mContext, "分享到QQ");
				popupWindow.dismiss();
			}
		});
		((ImageView) photosiew.findViewById(R.id.wx)).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				ToastUtil.showToast(mContext, "分享到WX");
				popupWindow.dismiss();
			}
		});
		((ImageView) photosiew.findViewById(R.id.yx)).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				ToastUtil.showToast(mContext, "分享到yx");
				popupWindow.dismiss();
			}
		});
		((ImageView) photosiew.findViewById(R.id.pyq)).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				ToastUtil.showToast(mContext, "分享到pyq");
				popupWindow.dismiss();
			}
		});
		((ImageView) photosiew.findViewById(R.id.sina)).setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				ToastUtil.showToast(mContext, "分享到sina");
				popupWindow.dismiss();
			}
		});
	}
}
